package com.ly.lypicturebackend.service;

import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper;
import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
import com.baomidou.mybatisplus.extension.service.IService;
import com.ly.lypicturebackend.api.aliyunai.model.CreateOutPaintingTaskResponse;
import com.ly.lypicturebackend.model.dto.picture.*;
import com.ly.lypicturebackend.model.entity.Picture;
import com.ly.lypicturebackend.model.entity.User;
import com.ly.lypicturebackend.model.vo.PictureVo;

import javax.servlet.http.HttpServletRequest;
import java.util.List;

/**
* @author luyi
* @description 针对表【picture(图片)】的数据库操作Service
* @createDate 2024-12-31 20:29:12
*/
public interface PictureService extends IService<Picture> {
    /**
     *
     *
     * @param inputSource 文件上传源
     * @param pictureUploadRequest 图片上传请求
     * @param loginUser 登录用户
     * @return pictureVo
     */
    PictureVo uploadPicture(Object inputSource, PictureUploadRequest pictureUploadRequest, User loginUser);
    /**
     * 获取查询条件
     */
    QueryWrapper<Picture> getQueryWrapper(PictureQueryRequest pictureQueryRequest);

    /**
     * 获取图片封装类
     * @param picture 图片
     * @return pictureVo
     */
    PictureVo getPictureVo(Picture picture, HttpServletRequest request);

    /**
     * 获取图片分页封装类
     */
    Page<PictureVo> getPictureVoPage(Page<Picture> picturePage, HttpServletRequest request);

    void validPicture(Picture picture);

    /**
     * 图片审核
     *
     * @param pictureReviewRequest
     * @param loginUser
     */
    void doPictureReview(PictureReviewRequest pictureReviewRequest, User loginUser);

    //补充审核参数
    void fillReviewParams(Picture picture, User loginUser);

    /**
     * 批量抓取和创建图片
     *
     * @param pictureUploadByBatchRequest 图片上传请求
     * @param loginUser 登录用户
     * @return 成功创建的图片数
     */
    Integer uploadPictureByBatch(
            PictureUploadByBatchRequest pictureUploadByBatchRequest,
            User loginUser
    );

    //清理图片
    void clearPictureFile(Picture oldPicture);

    void checkPictureAuth(User loginUser, Picture picture);

    void deletePicture(long pictureId, User loginUser);

    void editPicture(PictureEditRequest pictureEditRequest, User loginUser);

    List<PictureVo> searchPictureByColor(Long spaceId,String picColor,User loginUser);

    void editPictureByBatch(PictureEditByBatchRequest pictureEditByBatchRequest, User loginUser);

    CreateOutPaintingTaskResponse createPictureOutPaintingTask(CreatePictureOutPaintingTaskRequest createPictureOutPaintingTaskRequest, User loginUser);
}
